#include "CharacterCL.h"


void CharacterCL::init(Character* c)
{
	character = c;
}

void CharacterCL::BeginContact(b2Contact* contact)
{
    //check if fixture A was the foot sensor
    void* fixtureUserData = contact->GetFixtureA()->GetUserData();
    if ( (int)fixtureUserData == 3 )
		character->addNumFootContacts(1);
    //check if fixture B was the foot sensor
    fixtureUserData = contact->GetFixtureB()->GetUserData();
    if ( (int)fixtureUserData == 3 )
        character->addNumFootContacts(1);
}


void CharacterCL::EndContact(b2Contact* contact)
{
	//check if fixture A was the foot sensor
	void* fixtureUserData = contact->GetFixtureA()->GetUserData();
	if ( (int)fixtureUserData == 3 )
		character->addNumFootContacts(-1);
	//check if fixture B was the foot sensor
	fixtureUserData = contact->GetFixtureB()->GetUserData();
	if ( (int)fixtureUserData == 3 )
		character->addNumFootContacts(-1);
}
